package com.galangel.bookservice.controller;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.galangel.bookservice.entity.User;
import com.galangel.bookservice.service.IUserService;
import com.galangel.common.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author galangel
 * @since 2025-06-17
 */
@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {
    private final IUserService userService;

    @GetMapping("/{username}")
    public R getUser(@PathVariable String username){
        return R.ok(userService.getOne(
                Wrappers.<User>lambdaQuery().eq(User::getUsername, username)
        ));
    }
}
